﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace CertRequestor
{
   public partial class Form2 : Form
   {
      public Form2()
      {
         InitializeComponent();
      }

      public string GetPfxPath()
      {
         return m_path.Text;
      }

      public string GetPassword()
      {
         return m_password.Text;
      }

      private void m_yesButton_Click(object sender, EventArgs e)
      {
         if (m_path.Text.Length == 0)
         {
            MessageBox.Show("Please choose where to save the PFX file", "Empty field", MessageBoxButtons.OK, MessageBoxIcon.Warning );
         }
         else
         {
            if (  (m_password.Text.Length == 0)
                &&(DialogResult.No == MessageBox.Show("The password is empty.Do you want to continue?", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning))
               )
               return;
            DialogResult = DialogResult.OK;
            Close();
         }
      }

      private void button1_Click(object sender, EventArgs e)
      {
         if (m_pfxDlg.ShowDialog(this) == DialogResult.OK)
         {
            m_path.Text = m_pfxDlg.FileName;
         }
      }
   }
}
